package com.nbsaas.boot.order.data.entity;

import com.nbsaas.boot.code.annotation.*;
import com.nbsaas.boot.jpa.data.entity.AbstractEntity;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Table;
import lombok.Data;
import org.hibernate.annotations.Comment;

import java.math.BigDecimal;
import java.time.LocalDateTime;

@CreateByUser
@ComposeView
@Data
@FormAnnotation(title = "订单支付", model = "订单支付")
@Entity
@Table(name = "bs_order_payment")
@Comment("订单支付表")
public class OrderPayment extends AbstractEntity {

    @Comment("订单ID")
    @FormField(title = "订单ID", sortNum = "1", grid = true, required = true)
    @Column(name = "order_id", nullable = false)
    private Long orderId;

    @Comment("订单编号")
    @FormField(title = "订单编号", sortNum = "2", grid = true, required = true)
    @Column(name = "order_no", nullable = false, length = 64)
    private String orderNo;

    @Comment("支付单号")
    @FormField(title = "支付单号", sortNum = "3", grid = true, required = true)
    @Column(name = "payment_no", nullable = false, unique = true, length = 64)
    private String paymentNo;

    @Comment("支付方式")
    @FormField(title = "支付方式", sortNum = "4", grid = true, type = InputType.select)
    @Column(name = "payment_method", nullable = false)
    private Integer paymentMethod;

    @Comment("支付渠道")
    @FormField(title = "支付渠道", sortNum = "5", grid = true)
    @Column(name = "payment_channel", length = 50)
    private String paymentChannel;

    @Comment("支付金额")
    @FormField(title = "支付金额", sortNum = "6", grid = true, type = InputType.el_input_number)
    @Column(name = "payment_amount", nullable = false, precision = 10, scale = 2)
    private BigDecimal paymentAmount;

    @Comment("支付状态")
    @FormField(title = "支付状态", sortNum = "7", grid = true, type = InputType.select)
    @Column(name = "payment_status", nullable = false)
    private Integer paymentStatus = 0;

    @Comment("支付时间")
    @FormField(title = "支付时间", sortNum = "8", type = InputType.date, grid = true)
    @Column(name = "payment_time")
    private LocalDateTime paymentTime;

    @Comment("第三方交易号")
    @FormField(title = "第三方交易号", sortNum = "9", grid = true)
    @Column(name = "transaction_id", length = 100)
    private String transactionId;

    @Comment("支付备注")
    @FormField(title = "支付备注", sortNum = "10", type = InputType.textarea)
    @Column(name = "payment_remark", length = 200)
    private String paymentRemark;
} 